package demo8;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/*Spring配置类*/
@Configuration
@ComponentScan("demo8")
public class Config {
    @Bean
    public Student getStudent() {
        return new Student();
    }

    public DruidDataSource geDataSource() {
        DruidDataSource dataSource = new DruidDataSource();
        dataSource.setUrl("jdbc:mysql://localhost:3306/test");
        dataSource.setUsername("root");
        dataSource.setPassword("123457");
        dataSource.setInitialSize(5);
        dataSource.setMaxActive(10);

        return dataSource;
    }

}
